﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.ComponentModel;
using System.Data.Linq.Mapping;
using System.Collections.ObjectModel;
using System.Collections.Generic;

namespace Delay
{
    //public class DowloadManagerItem
    //{

    //}
    public class ConversationObject : DependencyObject, INotifyPropertyChanged
    {
        public string ContentInfo { get; set; }
        private string _expanderInfo;
        public string ExpanderInfo 
        {
            get
            {
                return _expanderInfo;
            }
            set
            {
                if (_expanderInfo != value)
                {
                    _expanderInfo = value;
                    NotifyPropertyChanged("ExpanderInfo");
                }
            }
        }
        private bool _isExpanded;
        public bool IsExpanded
        {
            get
            {
                return _isExpanded;
            }
            set
            {
                if (_isExpanded != value)
                {
                    _isExpanded = value;
                    NotifyPropertyChanged("IsExpanded");
                }
            }
        }
        private ObservableCollection<DowloadManagerItem> _item;
        public ObservableCollection<DowloadManagerItem> Item
        {
            get
            {
                return _item;
            }
            set
            {
                if (_item != value)
                {
                    _item = value;
                    NotifyPropertyChanged("Item");
                }
            }
        }
        private int _result;
        public int Result
        {
            get
            {
                return _result;
            }
            set
            {
                if (_result != value)
                {
                    _result = value;
                    NotifyPropertyChanged("Result");
                }
            }
        }
        public string ResultMsg
        {
            get;
            set;
        }
        private int _isLogo;
        public int IsLogo
        {
            get
            {
                return _isLogo;
            }
            set
            {
                if (_isLogo != value)
                {
                    _isLogo = value;
                    NotifyPropertyChanged("IsLogo");
                }
            }
        }

        public ConversationObject(string ci)
            : base()
        {
            ContentInfo = ci;

            


        }

      
        public event PropertyChangedEventHandler PropertyChanged;
        private void NotifyPropertyChanged(String propertyName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (null != handler)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }
        public string GetPhoneInfoUrl(string appID, int isadv)
        {
            string url = QueryXml.PhoneAdvertDetailsUrl;
            url += ("imei=" + QueryXml.imei);
            url += ("&phonename=" + QueryXml.phonename);
            url += ("&phonevs=" + QueryXml.phonevs);
            url += ("&phonevsno=" + QueryXml.phonevsno);
            url += ("&keyvalue=" + QueryXml.keyvalue);
            url += ("&channelkey=" + QueryXml.channelkey);
            url += ("&appid=" + appID);
            url += ("&isad=" + isadv);
            return url;
        }

    }
    [Table]
    public class DowloadManagerItem : DependencyObject, INotifyPropertyChanged
    {
      
        private int _index;
        [Column(IsPrimaryKey = true, CanBeNull = false, IsDbGenerated = true, DbType = "INT NOT NULL Identity", AutoSync = AutoSync.OnInsert)]
        public int Index
        {
            get
            {
                return _index;
            }
            set
            {
                if (_index != value)
                {

                    _index = value;
                    NotifyPropertyChanged("Index");
                }

            }
        }
        private string _appid;
        [Column]
        public string Appid
        {
            get
            {
                return _appid;
            }
            set
            {
                if (_appid != value)
                {

                    _appid = value;
                    NotifyPropertyChanged("Appid");
                }
            }
        }
        private string _title;
        [Column]
        public string Title
        {
            get
            {
                return _title;
            }
            set
            {
                if (_title != value)
                {

                    _title = value;
                    NotifyPropertyChanged("Title");
                }
            }
        }
        private string _type;
        [Column]
        public string Type
        {
            get
            {
                return _type;
            }
            set
            {
                if (_type != value)
                {

                    _type = value;
                    NotifyPropertyChanged("Type");
                }
            }
        }
        private int _result;
         [Column]
        public int Result
        {
            get
            {
                return _result;
            }
            set
            {
                if (_result != value)
                {
                    _result = value;
                    NotifyPropertyChanged("Result");
                }
            }
        }
        private string _icon;
        [Column]
        public string Icon
        {
            get
            {
                return _icon;
            }
            set
            {
                if (_icon != value)
                {
                    _icon = value;
                    NotifyPropertyChanged("Icon");
                }
            }
        }
        private int _downcount;
        [Column]
        public int Downcount
        {
            get
            {
                return _downcount;
            }
            set
            {
                if (_downcount != value)
                {
                    _downcount = value;
                    NotifyPropertyChanged("Downcount");
                }
            }
        }
        //userid
        private int _userid;
        [Column]
        public int Userid
        {
            get
            {
                return _userid;
            }
            set
            {
                if (_userid != value)
                {
                    _userid = value;
                    NotifyPropertyChanged("Userid");
                }
            }
        }
        //
        private int _score;
        [Column]
        public int Score
        {
            get
            {
                return _score;
            }
            set
            {
                if (_score != value)
                {
                    _score = value;
                    NotifyPropertyChanged("Score");
                }
            }
        }
        private int _isfee;
        [Column]
        public int Isfee
        {
            get
            {
                return _isfee;
            }
            set
            {
                if (_isfee != value)
                {
                    _isfee = value;
                    NotifyPropertyChanged("Isfee");
                }
            }
        }
        private int _hasFilesize;
        [Column]
        public int HasFilesize
        {
            get
            {
                return _hasFilesize;
            }
            set
            {
                if (_hasFilesize != value)
                {
                    _hasFilesize = value;
                    NotifyPropertyChanged("HasFilesize");
                }
            }
        }
        private string _filesize;
        [Column]
        public string Filesize
        {
            get
            {
                return _filesize;
            }
            set
            {
                if (_filesize != value)
                {
                    _filesize = value;
                    NotifyPropertyChanged("Filesize");
                }
            }
        }
        //取得文件大小的比特数
        private int _totalSize;
        [Column]
        public int TotalSize
        {
            get
            {
                return _totalSize;
            }
            set
            {
                if (_totalSize != value)
                {
                    _totalSize = value;
                    NotifyPropertyChanged("TotalSize");
                }
            }
        }
        private string _addtime;
        [Column]
        public string Addtime
        {
            get
            {
                return _addtime;
            }
            set
            {
                if (_addtime != value)
                {
                    _addtime = value;
                    NotifyPropertyChanged("Addtime");
                }
            }
        }
        private string _remark;
        [Column]
        public string Remark
        {
            get
            {
                return _remark;
            }
            set
            {
                if (_remark != value)
                {
                    _remark = value;
                    NotifyPropertyChanged("Remark");
                }
            }
        }
        private string _downurl;
        [Column]
        public string Downurl
        {
            get
            {
                return _downurl;
            }
            set
            {
                if (_downurl != value)
                {
                    _downurl = value;
                    NotifyPropertyChanged("Downurl");
                }
            }
        }
        //isreg
        public event PropertyChangedEventHandler PropertyChanged;
        private void NotifyPropertyChanged(String propertyName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (null != handler)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }

    }
}
